class BasicModel():

    self.__count=0

    def __init__(self):
        BasicModel.__count+=1
        self.filename=''
        self.id=0
        self.modelname=[]
        self.data=[]

    def set_filename(self,st):
        self.filename=st.strip()
        return self

    def set_id(self,n):
        self.id=n
        return self

    def set_modelname(self,st):
        self.modelname.append(st.strip())
        return self

    def init_data(self,n,default=0.0):
        self.data.append([default]*n)
        return self

    def set_data(self,n1,n2,x):
        self.data[n1][n2]=x
        return self

    def add_model(self,st,n,default=0.0):
        self.set_modelname(self,st)
        self.init_data(self,n,default)
        return self

    def get_filename(self):
        return self.filename
    
    def get_id(self,n):
        return self.id

    def get_modelname(self,n):
        return self.modelname[n]

    def get_nmodel(self):
        return len(self.modelname)

    def get_ndata(self,n):
        return len(self.data[n])

    def str2index(self,st):
        s=st.strip()
        for i,item in enumerate(self.modelname):
            if item == s:
                return i
        return -1

    def sCount():
        return BasicModel.__count

    def cCount(cls):
        return cls.__count

    scount = staticmethod(sCount)
    ccount = classmethod(cCount)

class BasicStageObject():

    __count = 0

    def __init__(self):
        self.__count+=1
        self.id=0
        self.next_flow=[]
        self.next_stage=[]
        self.path_prob=[]
        self.path_prop=[]
        self.stopcount=[]
        self.flowcount=[]
        self.path_info=[]

    def set_id(self,n):
        self.id=n
        return self
    
    def get_id(self):
        return self.id

    def set_next_flow(self,n):
        self.next_flow.append(n)
        return self

    def set_next_stage(self,n):
        self.next_stage.append(n)
        return self

    def set_path_prob(self,x):
        self.path_prob.append(x)
        return self

    def set_path_prop(self,x):
        self.path_prop.append(x)
        return self

    def set_path_info(self,d):
        self.path_info.append(d)
        return self

    def get_npath(self):
        return len(self.next_flow)

    def sCount():
        return BasicStageObject.__count

    def cCount(cls):
        return cls.__count

    scount = staticmethod(sCount)
    ccount = classmethod(cCount)

    def countstop(self,n):
        self.stopcount[n]+=1
        return self

    def countflow(self,n):
        self.flowcount[n]+=1
        return self

    def get_stopcount(self,n):
        return self.stopcount[n]

    def get_flowcount(self,n):
        return self.flowcount[n]

    def init_count(self):
        for item in stopcount:
            item=0
        for item in flowcount:
            item=0

class BasicFlowObject():

    __count = 0

    def __init__(self):
        self.__count+=1
        self.id=0
        self.stage=[]

    def set_id(self,n):
        self.id=n
        return self

    def get_nstage(self):
        return len(self.stage)

    def set_stage(self,s):
        self.stage.append(s)
        return self

    def sCount():
        return BasicFlowObject.__count

    def cCount(cls):
        return cls.__count

    scount = staticmethod(sCount)
    ccount = classmethod(cCount)
